package cn.neusoft.cglib;

/**
 * jdk动态代理   实现了接口的类型  class com.sun.proxy.$Proxy0
 * cglib动态代理   没有实现接口的类型   class cn.neusoft.cglib.OrderService$$EnhancerByCGLIB$$5b0c3604
 */
public class CglibTest {

    public static void main(String[] args) {

        OrderService target = new OrderService();
        CglibProxyFactory factory = new CglibProxyFactory();
        factory.setTarget(target);

        OrderService proxy = (OrderService)factory.getProxy();

        //class cn.neusoft.cglib.OrderService$$EnhancerByCGLIB$$5b0c3604
        System.out.println(proxy.getClass());

        proxy.add();
        System.out.println("-------------");
        proxy.update();
        System.out.println("-------------");
        proxy.getById();
        System.out.println("-------------");
        System.out.println(proxy.toString());
    }

}
